package com.sporadic.backstage.controller;

import com.sporadic.backstage.entity.DishesConfig;
import com.sporadic.backstage.service.DishesConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class DishesConfigController {
    @Autowired
    private DishesConfigService dishesConfigService;

    /**
     * 查询商家所有菜品配置
     * @param merchantId 商家编号
     * @return 菜品配置集合
     */
    @ResponseBody
    @RequestMapping("/selDishesConfigAll")
    public List<DishesConfig> selDishesConfigAll(Integer merchantId){
        return dishesConfigService.selDishesConfigAll(merchantId);
    }

    /**
     * 修改商家菜品配置
     * @param dishesConfig 配置信息详情
     * @return 受影响的行数
     */
    @ResponseBody
    @RequestMapping("/upDishesConfig")
    public Integer upDishesConfig(DishesConfig dishesConfig){
       return dishesConfigService.upDishesConfig(dishesConfig);
    }
}
